package cn.org.donald.file;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * @author Donald
 * @since 2023-11-03 15:07:39
 **/
public class CreateRandomFile {
    public static void main(String[] args) throws IOException {
        Path dir = Paths.get("E:\\two-thousand");
        Files.createDirectories(dir);
        for (int i = 0; i < 2000; i++) {
            Path file = dir.resolve(i + ".txt");
            Files.deleteIfExists(file);
            Files.createFile(file);
            Files.write(file, ("测试字符" + i).getBytes(StandardCharsets.UTF_8));
        }
    }
}
